import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { ReqUserWithdrawalAddressMobileList, PageResponse, PageData, UserWithdrawalAddressMobileList } from '../../model';
import { ApiService, urlService } from '../api';
import { CoreModule } from '../core.module';
import { CommonService } from './common.service';
import { retry } from 'rxjs/operators';
import { Observable } from 'rxjs';


@Injectable({
  providedIn: CoreModule
})
export class UserWithdrawalAddressService implements CommonService {



  // tslint:disable-next-line:max-line-length
  userWithdrawalAddressMobileList(params: ReqUserWithdrawalAddressMobileList): Observable<PageResponse<UserWithdrawalAddressMobileList>> {
    return this.api.post<PageResponse<UserWithdrawalAddressMobileList>>(
      this.getUrl('获取转账地址列表'), params
    ).pipe(
      retry(3)
    )
  }

  constructor(
    private api: ApiService
  ) { }

  error(error: any): void {
    this.api.goToWhere(error);
  }
  getUrl(apiName: string): string {
    return urlService(environment.type, apiName);
  }
}
